#include<stdio.h>
#include<C_CamDet.h>

CamPos camPos;
pthread_mutex_t mlock;

void __stdcall *threadFunc(void *arg) {
	updatePosition(&camPos, &mlock);
	return 0;
}

int main(void) {
	// CreateMutex();

	pthread_mutex_init(&mlock, NULL);

	camPos.err_no = 0;
#ifdef WIN32
	CreatThreadCP(threadFunc);
#else
	pthread_t pt;
	pthread_create(&pt, NULL, threadFunc, NULL);
#endif /* WIN32 */
	while (1)
	{
		WaitMutexCP(mlock);
		if (camPos.isInitDet)
		{
			printf("%d,%d | %d\n",camPos.initPt.x,camPos.initPt.y, (int)camPos.initArea);
		}
		else
			printf("-1\n");
		ExitMutexCP(mlock);
		DelayCP(500);
	}

	return 0;
}
